<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title> BaseDemo </title>
        <script type="text/javascript">
            window.onload = function() {
                var tableNode = document.createElement("table");
                var trNode = document.createElement("tr");
                var tdNode = document.createElement("td");
                var text = document.createTextNode("这是新单元格。");
                tdNode.appendChild(text);
                trNode.appendChild(tdNode);
                tableNode.appendChild(trNode);
                var element = document.getElementById("div4");
                element.innerHTML = "";
                element.appendChild(tableNode);
                
                var tb = document.getElementsByTagName("table")[0];
                tb.style.color = "blue";
                tb.style.fontWeight = "bold";
                tb.style.border="2px #69c solid";
                //alert(tableNode.nodeName+"  "+tableNode.nodeType);   
                //tb.appendChild(tdNode.appendChild(text.cloneNode())); 
                //tdNode.cloneNode().appendChild(
            };
        </script>
        <style type="text/css">
            div {
                border: thin #ccc solid;
                padding: 5px;
                margin: 3px;
            }
        </style>
    </head>
    <body>
        <h2 align="center">BaseDemo Page</h2>
        <br />
        <div id="div1" class="first-div">
            ID为div1,class为first-div
        </div>
        <div id="div2" class="first-div">
            ID为div2,class为first-div
        </div>
        <div id="div3" class="second-div">
            ID为div3,class为second-div
        </div>
        <div id="div4" class="second-div">
            ID为div4,class为second-div
        </div>
    </body>
</html>